from django.db import models

# Create your models here.

status_choies= (
    (1,'已完成'),
    (0,'未开始'),
    (2,'正在进行'),
)
month_choies = (
    (1,'1月'),
    (2,'2月'),
    (3,'3月'),
    (4,'4月'),
    (5,'5月'),
    (6,'6月'),
    (7,'7月'),
    (8,'8月'),
    (9,'9月'),
    (10,'10月'),
    (11,'11月'),
    (12,'12月'),
)

class Detail(models.Model):
    month = models.SmallIntegerField(verbose_name="月份",choices=month_choies,default=1)
    content_title = models.CharField(verbose_name="工作计划",max_length=20)
    content_detail = models.CharField(verbose_name="计划详情",max_length=220,null=True,blank=True)
    status = models.SmallIntegerField(verbose_name="计划状态",default=0,choices=status_choies)
    create_date = models.DateTimeField(auto_now_add=True)
    department = models.ForeignKey(to="Department",on_delete=models.CASCADE)
    leader = models.ForeignKey(to="User",on_delete=models.CASCADE,verbose_name="责任人")

class User(models.Model):
    username=models.CharField(verbose_name="用户名",max_length=200)
    password = models.CharField(verbose_name="密码",max_length=200)
    name = models.CharField(verbose_name="姓名",max_length=200)
    department = models.ForeignKey(to='Department',on_delete=models.CASCADE,verbose_name="责任单位")
    def __str__(self):
        return self.name

class Department(models.Model):
    title = models.CharField(verbose_name="部门",max_length=200)

    def __str__(self):
        return self.title


